@extends('layouts.admin')

@section('content')
@include('group.nav')

<table class="table table-bordered mt-3 shadow-sm">
    <thead>
        <tr>
            <th width='80'>编号</th>
            <th width='100'>用户组</th>
            <th>包含套餐</th>
            <th>包含模块</th>
            <th width='150'>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach ($groups as $group)
        <tr>
            <td>{{$group['id']}}</td>
            <td>{{$group['title']}}</td>
            <td>
                @foreach ($group->packages as $package)
                <a href="{{ route('admin.package.edit',$package) }}" class='badge badge-info'>{{$package['title']}}</a>
                @endforeach
            </td>
            <td>
                @foreach ($group->modules as $module)
                <a href="{{ route('admin.module.index') }}" class='badge badge-info'>{{$module['title']}}</a>
                @endforeach
            </td>
            <td>
                <div class="btn-group btn-group-sm" role="group">
                    <a href="{{route('admin.group.edit',$group)}}" class="btn btn-info">编辑</a>
                    @if($group['id']>1)
                    <btn-del  class-name="btn btn-danger btn-sm" action='{{ route('admin.group.destroy',$group) }}'>刪除</btn-del>
                    @endif
                </div>
            </td>
        </tr>
        @endforeach
    </tbody>
</table>
@endsection
